<template>
    <view>
        <div class="jq22-head-body">
            <img src="static/images/head.jpg" alt="" />
            <div class="jq22-user-item">
                <div class="jq22-mine-user"><img src="static/images/user-logo-001.jpg" alt="" /></div>
                <div class="jq22-mine-name">
                    <h2>{{ form.username }}</h2>
                </div>
            </div>
        </div>
        <view class="wrap">
            <u-form :model="form" ref="uForm">
                <u-form-item label="姓名" label-position="top"><u-input v-model="form.username" /></u-form-item>
                <u-form-item label="性别" label-position="top">
                    <u-input v-model="form.sex" type="select" @click="show = true" />
                    <u-select v-model="show" :list="list_sex" @confirm="confirm"></u-select>
                </u-form-item>
                <u-form-item label="学校" label-position="top"><u-input v-model="form.school" /></u-form-item>
                <u-form-item label="专业" label-position="top"><u-input v-model="form.major" /></u-form-item>
                <u-form-item label="邮件" label-position="top"><u-input v-model="form.mail" /></u-form-item>
            </u-form>
        </view>
        <view class="u-m-t-20">
            <u-row gutter="16" justify="center">
                <u-col span="10"><u-button type="primary" @click="saveData()" :ripple="true">保存</u-button></u-col>
            </u-row>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            user: {},
            form: {},
            show: false,
            list_sex: [
                {
                    value: '男',
                    label: '男'
                },
                {
                    value: '女',
                    label: '女'
                }
            ]
        }
    },
    onShow() {
        uni.setNavigationBarTitle({
            title: '个人中心'
        })
    },
    onLoad() {
        this.user = uni.getStorageSync('user_info')
        this.form.id = this.user.id
        
    },
    mounted() {
       this.getData()
    },
    methods: {
        getData(){
            this.$u.post('/apps/sysUserEntity/getInfo', this.form).then(res => {
                if (res && res.code == 200) {
                   this.form = res.info
                }
            })
        },
        saveData() {
            this.form.cSubject = JSON.stringify(this.form)
            this.$u.post('/apps/sysUserEntity/info', this.form).then(res => {
                if (res && res.code == 200) {
                    this.$u.route({
                        type: 'switchTab',
                        url: 'pages/wxCenter/index'
                    })
                }
            })
        },
        confirm(e) {
            console.log(e[0])
            this.form.sex = e[0].value
        }
    }
}
</script>

<style lang="scss">
.wrap {
    padding: 24rpx;
}

html,
body {
    color: #333;
    margin: 0;
    height: 100%;
    font-family: 'Myriad Set Pro', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: normal;
}

* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: #000;
}

a,
label,
button,
input,
select {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

img {
    border: 0;
}

body {
    background: #fefefe;
    color: #666;
}

html,
body,
div,
dl,
dt,
dd,
ol,
ul,
li,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
button,
fieldset,
form,
input,
legend,
textarea,
th,
td {
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
    color: #08acee;
}

button {
    outline: 0;
}

img {
    border: 0;
}

button,
input,
optgroup,
select,
textarea {
    margin: 0;
    font: inherit;
    color: inherit;
    outline: none;
}

li {
    list-style: none;
}

a {
    color: #666;
}

.clearfix::after {
    clear: both;
    content: '.';
    display: block;
    height: 0;
    visibility: hidden;
}

.clearfix {
}

.divHeight {
    width: 100%;
    height: 10px;
    background: #f5f5f5;
    position: relative;
    overflow: hidden;
}

.r-line {
    position: relative;
}

.r-line:after {
    content: '';
    position: absolute;
    z-index: 0;
    top: 0;
    right: 0;
    height: 100%;
    border-right: 1px solid #d9d9d9;
    -webkit-transform: scaleX(0.5);
    transform: scaleX(0.5);
    -webkit-transform-origin: 100% 0;
    transform-origin: 100% 0;
}

.b-line {
    position: relative;
}

.b-line:after {
    content: '';
    position: absolute;
    z-index: 2;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    border-bottom: 1px solid #e2e2e2;
    -webkit-transform: scaleY(0.5);
    transform: scaleY(0.5);
    -webkit-transform-origin: 0 100%;
    transform-origin: 0 100%;
}

.jq22-flex {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 15px;
    position: relative;
}

.jq22-flex-box {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #333;
}

/* 必要布局样式css */

.jq22-flexView {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
}

.jq22-scrollView {
    width: 100%;
    height: 100%;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.jq22-navBar {
    height: 44px;
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    z-index: 1002;
    background: #fefefe;
}

.jq22-navBar-item {
    height: 44px;
    min-width: 25%;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 25%;
    -ms-flex: 0 0 25%;
    flex: 0 0 25%;
    padding: 0 0.9rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    color: #808080;
    position: relative;
}

.jq22-navBar-item:first-child {
    -webkit-box-ordinal-group: 2;
    -webkit-order: 1;
    -ms-flex-order: 1;
    order: 1;
    margin-right: -25%;
    font-size: 0.9rem;
    font-weight: bold;
}

.jq22-navBar-item:last-child {
    -webkit-box-ordinal-group: 4;
    -webkit-order: 3;
    -ms-flex-order: 3;
    order: 3;
    -webkit-box-pack: end;
    -webkit-justify-content: flex-end;
    -ms-flex-pack: end;
    justify-content: flex-end;
}

.jq22-center {
    -webkit-box-ordinal-group: 3;
    -webkit-order: 2;
    -ms-flex-order: 2;
    order: 2;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    height: 44px;
    width: 50%;
    margin-left: 25%;
}

.jq22-center-title {
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    display: block;
    text-overflow: ellipsis;
    font-size: 0.95rem;
    color: #333;
}

.icon {
    width: 20px;
    height: 20px;
    display: block;
    border: none;
    float: left;
    background-size: 20px;
    background-repeat: no-repeat;
}

.jq22-head-body {
    width: 100%;
    height: auto;
    position: relative;
}

.jq22-head-body img {
    width: 100%;
    height: auto;
    display: block;
    border: none;
}

.jq22-user-item {
    position: absolute;
    left: 50%;
    width: 110px;
    margin-left: -55px;
    bottom: 30px;
}

.jq22-mine-user {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.jq22-mine-user img {
    width: 80px;
    height: 80px;
    border-radius: 100%;
    border: 3px solid rgba(255, 255, 255, 0.4);
}

.jq22-mine-name h2 {
    color: #fff;
    font-size: 1rem;
    padding-top: 0.5rem;
    text-align: center;
}

.icon-edit {
    background-image: url('');
    float: right;
    margin-left: 0.5rem;
}

.icon-news {
    background-image: url('');
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.jq22-palace {
    padding: 0.9rem 0;
    position: relative;
    overflow: hidden;
    background: #fff;
    width: 90%;
    margin: 1rem auto 0;
    box-shadow: 0 0 11px #f1f2f5;
    border-radius: 5px;
}

.jq22-palace-grid {
    position: relative;
    float: left;
    padding: 1px;
    width: 33.333%;
    box-sizing: border-box;
    margin-bottom: 10px;
    margin-top: 10px;
}

.jq22-palace-grid-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto;
}

.jq22-palace-grid-icon img {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

.jq22-palace-grid-text {
    display: block;
    text-align: center;
    color: #333;
    font-size: 0.85rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    padding-top: 0.2rem;
}

.jq22-palace-grid-text h2 {
    font-size: 0.85rem;
    font-weight: normal;
    color: #2b2f32;
}

.jq22-landlady {
    padding: 0.9rem 0;
    position: relative;
    overflow: hidden;
    background: #fff;
    width: 90%;
    margin: 1rem auto 0;
    box-shadow: 0 0 11px #f1f2f5;
    border-radius: 5px;
    text-align: center;
}

.jq22-landlady h2 {
    font-size: 1rem;
    color: #16bd87;
}

.jq22-flex-box h3 {
    font-size: 0.85rem;
    font-weight: normal;
    text-align: left;
}

.jq22-arrow {
    position: relative;
    padding-right: 13px;
}

.jq22-arrow:after {
    content: ' ';
    display: inline-block;
    height: 8px;
    width: 8px;
    border-width: 2px 2px 0 0;
    border-color: #c7c7cc;
    border-style: solid;
    -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
    transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
    position: relative;
    top: -2px;
    position: absolute;
    top: 50%;
    margin-top: -4px;
    right: 1px;
    border-radius: 1px;
}

.jq22-footer {
    width: 100%;
    position: relative;
    z-index: 100;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    padding: 7px 5px 7px 5px;
    background: #fefefe;
}

.jq22-tabBar-item {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    color: #979797;
}

.jq22-tabBar-item-text {
    display: inline-block;
    font-size: 0.65rem;
    color: #bdbdbd;
    padding-top: 2px;
}

.jq22-tabBar-item-active .jq22-tabBar-item-text {
    color: #484848;
}

.icon-loan {
    background-image: url('');
}

.icon-credit {
    background-image: url('');
}

.icon-ions {
    background-image: url('');
}

.icon-my {
    background-image: url('');
}

.jq22-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 49;
}
</style>
